package com.zxbg.dao;

import com.zxbg.domain.ProcessRuleContent;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ProcessRuleContentDao {

    @Select("select * from process_rule_content where process_rule_code = #{process_rule_code} and tenant_id = #{tenant_id} order by `order`")
    public List<ProcessRuleContent> getProcessRuleContent(@Param("process_rule_code") String process_rule_code, @Param("tenant_id") Integer tenant_id);

    @Insert("insert into process_rule_content values(null, #{process_rule_code}, #{process_node}, #{button_id}, #{setting}, #{order}, #{task_mode}, #{select_mode}, #{tenant_id})")
    public int saveProcessRuleContent(ProcessRuleContent processRuleContent);

    @Update("update process_rule_content set process_node = #{process_node}, button_id = #{button_id}, setting = #{setting}, `order` = #{order}, task_mode = #{task_mode}, select_mode = #{select_mode} where id = #{id}")
    public int updateProcessRuleContent(ProcessRuleContent processRuleContent);

    @Select("select id from process_rule_content where process_rule_code = #{process_rule_code} and tenant_id = #{tenant_id}")
    public List<Integer> getProcessRuleContentId(@Param("process_rule_code") String process_rule_code, @Param("tenant_id") Integer tenant_id);

    @Delete("delete from process_rule_content where id = #{id}")
    public int deleteContentById(Integer id);

    @Select("select * from process_rule_content where id = #{id}")
    public ProcessRuleContent getProcessRuleContentById(Integer id);
}
